﻿<phone:PhoneApplicationPage 
    x:Class="SaveFuel.Configuration"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:lang="clr-namespace:SaveFuel"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <lang:LocalizedStrings x:Key="LocalizedResources"/>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina-->
    <Grid x:Name="LayoutRoot" Background="Transparent" DataContext="{Binding Source={StaticResource LocalizedResources}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=LocalizedResources.ApplicationTitle}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitleConfiguration" Text="{Binding Path=LocalizedResources.PageTitleConfiguration}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - inserire ulteriore contenuto qui-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel>
                <toolkit:ToggleSwitch x:Name="GPSToggle" Header="{Binding Path=LocalizedResources.GPSToggle}"
                                  Checked="GPSToggle_Checked"
                                  Unchecked="GPSToggle_Unchecked"
                                  Loaded="GPSToggle_Loaded">
                </toolkit:ToggleSwitch>

                <StackPanel Margin="0,30,0,0">
                    <TextBlock x:Name="txtDistanceUnit" Text="{Binding Path=LocalizedResources.txtDistanceUnit}"></TextBlock>
                    <toolkit:ListPicker x:Name="DistanceUnit" ItemsSource="{Binding distanceUnits}" Loaded="DistanceUnit_Loaded">                    
                    </toolkit:ListPicker>

                    <TextBlock x:Name="txtMoneyUnit" Text="{Binding Path=LocalizedResources.txtMoneyUnit}"></TextBlock>
                    <toolkit:ListPicker x:Name="MoneyUnit" ItemsSource="{Binding moneyUnits, Mode=TwoWay}" Loaded="MoneyUnit_Loaded">
                    </toolkit:ListPicker>

                    <TextBlock x:Name="txtVolumeUnit" Text="{Binding Path=LocalizedResources.txtVolumeUnit}"></TextBlock>
                    <toolkit:ListPicker x:Name="VolumeUnit" ItemsSource="{Binding volumeUnits}" Loaded="VolumeUnit_Loaded">
                    </toolkit:ListPicker>
                </StackPanel>
            </StackPanel>
        </Grid>

        <StackPanel Visibility="Collapsed">
            <TextBlock x:Name="DistanceUnitKm" Text="{Binding Path=LocalizedResources.DistanceUnitKm}"></TextBlock>
            <TextBlock x:Name="DistanceUnitMi" Text="{Binding Path=LocalizedResources.DistanceUnitMi}"></TextBlock>

            <TextBlock x:Name="MoneyUnitEuro" Text="{Binding Path=LocalizedResources.MoneyUnitEuro}"></TextBlock>
            <TextBlock x:Name="MoneyUnitPound" Text="{Binding Path=LocalizedResources.MoneyUnitPound}"></TextBlock>
            <TextBlock x:Name="MoneyUnitDollar" Text="{Binding Path=LocalizedResources.MoneyUnitDollar}"></TextBlock>

            <TextBlock x:Name="VolumeUnitLtr" Text="{Binding Path=LocalizedResources.VolumeUnitLtr}"></TextBlock>
            <TextBlock x:Name="volumeUnitGal" Text="{Binding Path=LocalizedResources.volumeUnitGal}"></TextBlock>
        </StackPanel>

    </Grid>

    <!--Codice di esempio che illustra l'utilizzo di ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="doneClick" IconUri="/Images/Icons/dark/appbar.check.rest.png" Text="done" Click="doneClick_Click" />
            <shell:ApplicationBarIconButton x:Name="cancelClick" IconUri="/Images/Icons/dark/appbar.cancel.rest.png" Text="cancel" Click="cancelClick_Click" />
            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="Voce di menu 1"/>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="Voce di menu 2"/>
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
